<template>
  <div class="text-detection">
    <!-- 页面标题 -->
    <div class="page-header">
      <h1>AI文本检测</h1>
      <p>识别ChatGPT、Claude等AI大模型生成的文本内容</p>
    </div>

    <!-- 文本输入区域 -->
    <div class="input-section">
      <div class="input-container">
        <div class="input-methods">
          <button 
            v-for="method in inputMethods" 
            :key="method.id"
            class="method-btn"
            :class="{ active: activeMethod === method.id }"
            @click="switchMethod(method.id)"
          >
            {{ method.icon }} {{ method.label }}
          </button>
        </div>
        
        <div v-if="activeMethod === 'direct'" class="direct-input">
          <textarea 
            v-model="inputText"
            placeholder="请输入需要检测的文本内容..."
            class="text-input"
            @input="onTextInput"
          ></textarea>
          <div class="input-stats">
            <span>字符数: {{ inputText.length }}</span>
            <span>单词数: {{ wordCount }}</span>
            <span>段落数: {{ paragraphCount }}</span>
          </div>
        </div>
        
        <div v-if="activeMethod === 'file'" class="file-input">
          <div class="file-upload" @dragover.prevent @drop="handleFileDrop">
            <div class="upload-icon">📄</div>
            <p>拖拽文件到这里或点击上传</p>
            <p class="file-hint">支持 .txt, .docx, .pdf 格式</p>
            <input 
              ref="fileInput" 
              type="file" 
              accept=".txt,.docx,.pdf"
              @change="handleFileUpload"
              style="display: none;"
            />
            <button class="upload-btn" @click="$refs.fileInput.click()">
              选择文件
            </button>
          </div>
        </div>
        
        <div v-if="activeMethod === 'url'" class="url-input">
          <div class="url-form">
            <input 
              v-model="urlInput"
              placeholder="请输入网页链接..."
              class="url-field"
            />
            <button class="fetch-btn" @click="fetchFromUrl">
              获取内容
            </button>
          </div>
        </div>
      </div>
      
      <div class="detection-controls">
        <button 
          class="detect-btn"
          @click="startDetection"
          :disabled="!inputText || isDetecting"
        >
          {{ isDetecting ? '检测中...' : '开始检测' }}
        </button>
        <button class="clear-btn" @click="clearAll">
          清空内容
        </button>
      </div>
    </div>

    <!-- 检测结果 -->
    <div v-if="detectionResult" class="result-section">
      <div class="result-header">
        <h2>检测结果</h2>
        <div class="confidence-score">
          <div class="score-circle" :class="getScoreClass(detectionResult.aiProbability)">
            {{ detectionResult.aiProbability }}%
          </div>
          <div class="score-label">AI生成概率</div>
        </div>
      </div>
      
      <div class="result-tabs">
        <button 
          v-for="tab in resultTabs" 
          :key="tab.id"
          class="tab-btn"
          :class="{ active: activeResultTab === tab.id }"
          @click="activeResultTab = tab.id"
        >
          {{ tab.label }}
        </button>
      </div>
      
      <div class="result-content">
        <!-- 基本分析 -->
        <div v-if="activeResultTab === 'basic'" class="basic-analysis">
          <div class="analysis-grid">
            <div class="analysis-card">
              <h3>文本特征</h3>
              <div class="feature-list">
                <div class="feature-item">
                  <span class="feature-label">语言风格：</span>
                  <span class="feature-value">{{ detectionResult.style }}</span>
                </div>
                <div class="feature-item">
                  <span class="feature-label">复杂度：</span>
                  <span class="feature-value">{{ detectionResult.complexity }}</span>
                </div>
                <div class="feature-item">
                  <span class="feature-label">创造性：</span>
                  <span class="feature-value">{{ detectionResult.creativity }}</span>
                </div>
                <div class="feature-item">
                  <span class="feature-label">逻辑性：</span>
                  <span class="feature-value">{{ detectionResult.logic }}</span>
                </div>
              </div>
            </div>
            
            <div class="analysis-card">
              <h3>可能的AI模型</h3>
              <div class="model-predictions">
                <div 
                  v-for="model in detectionResult.possibleModels" 
                  :key="model.name"
                  class="model-item"
                >
                  <div class="model-name">{{ model.name }}</div>
                  <div class="model-probability">
                    <div class="probability-bar">
                      <div 
                        class="probability-fill"
                        :style="{ width: model.probability + '%' }"
                      ></div>
                    </div>
                    <span class="probability-text">{{ model.probability }}%</span>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 语言分析 -->
        <div v-if="activeResultTab === 'language'" class="language-analysis">
          <div class="metrics-grid">
            <div class="metric-card">
              <h3>语言特征分析</h3>
              <div class="metric-item">
                <span class="metric-label">词汇多样性：</span>
                <div class="metric-bar">
                  <div class="metric-fill" :style="{ width: detectionResult.vocabularyDiversity + '%' }"></div>
                </div>
                <span class="metric-value">{{ detectionResult.vocabularyDiversity }}%</span>
              </div>
              <div class="metric-item">
                <span class="metric-label">句式变化：</span>
                <div class="metric-bar">
                  <div class="metric-fill" :style="{ width: detectionResult.sentenceVariation + '%' }"></div>
                </div>
                <span class="metric-value">{{ detectionResult.sentenceVariation }}%</span>
              </div>
              <div class="metric-item">
                <span class="metric-label">语法复杂度：</span>
                <div class="metric-bar">
                  <div class="metric-fill" :style="{ width: detectionResult.grammaticalComplexity + '%' }"></div>
                </div>
                <span class="metric-value">{{ detectionResult.grammaticalComplexity }}%</span>
              </div>
            </div>
            
            <div class="metric-card">
              <h3>语义分析</h3>
              <div class="metric-item">
                <span class="metric-label">语义连贯性：</span>
                <div class="metric-bar">
                  <div class="metric-fill" :style="{ width: detectionResult.semanticCoherence + '%' }"></div>
                </div>
                <span class="metric-value">{{ detectionResult.semanticCoherence }}%</span>
              </div>
              <div class="metric-item">
                <span class="metric-label">上下文理解：</span>
                <div class="metric-bar">
                  <div class="metric-fill" :style="{ width: detectionResult.contextualUnderstanding + '%' }"></div>
                </div>
                <span class="metric-value">{{ detectionResult.contextualUnderstanding }}%</span>
              </div>
              <div class="metric-item">
                <span class="metric-label">逻辑推理：</span>
                <div class="metric-bar">
                  <div class="metric-fill" :style="{ width: detectionResult.logicalReasoning + '%' }"></div>
                </div>
                <span class="metric-value">{{ detectionResult.logicalReasoning }}%</span>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 段落分析 -->
        <div v-if="activeResultTab === 'paragraph'" class="paragraph-analysis">
          <h3>段落级别分析</h3>
          <div class="paragraph-list">
            <div 
              v-for="(paragraph, index) in detectionResult.paragraphs" 
              :key="index"
              class="paragraph-item"
            >
              <div class="paragraph-header">
                <span class="paragraph-index">段落 {{ index + 1 }}</span>
                <div class="paragraph-score" :class="getScoreClass(paragraph.aiProbability)">
                  {{ paragraph.aiProbability }}%
                </div>
              </div>
              <div class="paragraph-content">
                {{ paragraph.content }}
              </div>
              <div class="paragraph-analysis-details">
                <div class="analysis-item">
                  <span class="analysis-label">特征强度：</span>
                  <span class="analysis-value">{{ paragraph.featureStrength }}</span>
                </div>
                <div class="analysis-item">
                  <span class="analysis-label">异常指标：</span>
                  <span class="analysis-value">{{ paragraph.anomalyScore }}</span>
                </div>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 技术细节 -->
        <div v-if="activeResultTab === 'technical'" class="technical-details">
          <div class="technical-grid">
            <div class="technical-card">
              <h3>检测模型信息</h3>
              <div class="tech-info">
                <div class="tech-item">
                  <span class="tech-label">模型版本：</span>
                  <span class="tech-value">{{ detectionResult.modelVersion }}</span>
                </div>
                <div class="tech-item">
                  <span class="tech-label">处理时间：</span>
                  <span class="tech-value">{{ detectionResult.processingTime }}</span>
                </div>
                <div class="tech-item">
                  <span class="tech-label">检测精度：</span>
                  <span class="tech-value">{{ detectionResult.accuracy }}%</span>
                </div>
              </div>
            </div>
            
            <div class="technical-card">
              <h3>统计信息</h3>
              <div class="stats-grid">
                <div class="stat-item">
                  <div class="stat-value">{{ detectionResult.totalWords }}</div>
                  <div class="stat-label">总词数</div>
                </div>
                <div class="stat-item">
                  <div class="stat-value">{{ detectionResult.uniqueWords }}</div>
                  <div class="stat-label">独特词汇</div>
                </div>
                <div class="stat-item">
                  <div class="stat-value">{{ detectionResult.avgSentenceLength }}</div>
                  <div class="stat-label">平均句长</div>
                </div>
                <div class="stat-item">
                  <div class="stat-value">{{ detectionResult.readabilityScore }}</div>
                  <div class="stat-label">可读性</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      
      <div class="result-actions">
        <button class="export-btn" @click="exportResult">
          导出报告
        </button>
        <button class="share-btn" @click="shareResult">
          分享结果
        </button>
      </div>
    </div>

    <!-- 批量检测 -->
    <div class="batch-section">
      <h2>批量检测</h2>
      <div class="batch-container">
        <div class="batch-input">
          <textarea 
            v-model="batchTexts"
            placeholder="请输入多个文本，每行一个..."
            class="batch-textarea"
          ></textarea>
          <div class="batch-info">
            <span>共 {{ batchTexts.split('\n').filter(t => t.trim()).length }} 条文本</span>
          </div>
        </div>
        
        <div class="batch-controls">
          <button 
            class="batch-detect-btn"
            @click="startBatchDetection"
            :disabled="!batchTexts.trim() || isBatchDetecting"
          >
            {{ isBatchDetecting ? '批量检测中...' : '开始批量检测' }}
          </button>
          <button class="batch-clear-btn" @click="clearBatch">
            清空
          </button>
        </div>
      </div>
      
      <div v-if="batchResults.length > 0" class="batch-results">
        <div class="batch-header">
          <h3>批量检测结果</h3>
          <div class="batch-summary">
            <span>AI生成: {{ batchResults.filter(r => r.aiProbability > 50).length }}</span>
            <span>人类创作: {{ batchResults.filter(r => r.aiProbability <= 50).length }}</span>
          </div>
        </div>
        
        <div class="batch-list">
          <div 
            v-for="(result, index) in batchResults" 
            :key="index"
            class="batch-item"
          >
            <div class="batch-item-header">
              <span class="batch-item-index">{{ index + 1 }}</span>
              <div class="batch-item-score" :class="getScoreClass(result.aiProbability)">
                {{ result.aiProbability }}%
              </div>
            </div>
            <div class="batch-item-content">
              {{ result.text.substring(0, 100) }}{{ result.text.length > 100 ? '...' : '' }}
            </div>
            <div class="batch-item-actions">
              <button class="detail-btn" @click="showBatchDetail(result)">
                查看详情
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, computed, watch } from 'vue'

// 响应式数据
const activeMethod = ref('direct')
const inputText = ref('')
const urlInput = ref('')
const batchTexts = ref('')
const isDetecting = ref(false)
const isBatchDetecting = ref(false)
const detectionResult = ref(null)
const batchResults = ref([])
const activeResultTab = ref('basic')

// 输入方法
const inputMethods = [
  { id: 'direct', label: '直接输入', icon: '✍️' },
  { id: 'file', label: '文件上传', icon: '📁' },
  { id: 'url', label: '网页链接', icon: '🌐' }
]

// 结果标签页
const resultTabs = [
  { id: 'basic', label: '基本分析' },
  { id: 'language', label: '语言特征' },
  { id: 'paragraph', label: '段落分析' },
  { id: 'technical', label: '技术细节' }
]

// 计算属性
const wordCount = computed(() => {
  return inputText.value.trim().split(/\s+/).filter(word => word.length > 0).length
})

const paragraphCount = computed(() => {
  return inputText.value.trim().split(/\n\s*\n/).filter(p => p.trim().length > 0).length
})

// 监听器
watch(inputText, (newText) => {
  if (newText.length > 0) {
    detectionResult.value = null
  }
})

// 方法
const switchMethod = (methodId) => {
  activeMethod.value = methodId
  inputText.value = ''
  detectionResult.value = null
}

const onTextInput = () => {
  // 实时提示或其他逻辑
}

const handleFileDrop = (e) => {
  e.preventDefault()
  const files = Array.from(e.dataTransfer.files)
  if (files.length > 0) {
    processFile(files[0])
  }
}

const handleFileUpload = (e) => {
  const file = e.target.files[0]
  if (file) {
    processFile(file)
  }
}

const processFile = (file) => {
  // 模拟文件处理
  const reader = new FileReader()
  reader.onload = (e) => {
    inputText.value = e.target.result
  }
  reader.readAsText(file)
}

const fetchFromUrl = async () => {
  // 模拟从URL获取内容
  if (urlInput.value.trim()) {
    inputText.value = '这是从网页获取的示例文本内容...'
  }
}

const startDetection = async () => {
  if (!inputText.value.trim()) return
  
  isDetecting.value = true
  
  // 模拟AI检测
  await new Promise(resolve => setTimeout(resolve, 2000))
  
  const aiProbability = Math.floor(Math.random() * 100)
  
  detectionResult.value = {
    aiProbability,
    style: aiProbability > 70 ? '技术性' : '自然化',
    complexity: aiProbability > 60 ? '中等' : '较高',
    creativity: aiProbability > 80 ? '较低' : '中等',
    logic: aiProbability > 70 ? '很强' : '中等',
    possibleModels: [
      { name: 'GPT-4', probability: Math.floor(Math.random() * 30) + 20 },
      { name: 'Claude', probability: Math.floor(Math.random() * 25) + 15 },
      { name: 'Gemini', probability: Math.floor(Math.random() * 20) + 10 }
    ],
    vocabularyDiversity: Math.floor(Math.random() * 40) + 60,
    sentenceVariation: Math.floor(Math.random() * 35) + 65,
    grammaticalComplexity: Math.floor(Math.random() * 45) + 55,
    semanticCoherence: Math.floor(Math.random() * 30) + 70,
    contextualUnderstanding: Math.floor(Math.random() * 25) + 75,
    logicalReasoning: Math.floor(Math.random() * 35) + 65,
    paragraphs: generateParagraphAnalysis(inputText.value),
    modelVersion: 'TextDetector v3.2',
    processingTime: '1.2s',
    accuracy: '94.5',
    totalWords: wordCount.value,
    uniqueWords: Math.floor(wordCount.value * 0.7),
    avgSentenceLength: Math.floor(Math.random() * 10) + 15,
    readabilityScore: Math.floor(Math.random() * 30) + 70
  }
  
  isDetecting.value = false
  activeResultTab.value = 'basic'
}

const generateParagraphAnalysis = (text) => {
  const paragraphs = text.split(/\n\s*\n/).filter(p => p.trim().length > 0)
  return paragraphs.map(p => ({
    content: p.trim(),
    aiProbability: Math.floor(Math.random() * 100),
    featureStrength: ['弱', '中', '强'][Math.floor(Math.random() * 3)],
    anomalyScore: Math.floor(Math.random() * 30) + 20
  }))
}

const startBatchDetection = async () => {
  const texts = batchTexts.value.split('\n').filter(t => t.trim())
  if (texts.length === 0) return
  
  isBatchDetecting.value = true
  batchResults.value = []
  
  for (const text of texts) {
    await new Promise(resolve => setTimeout(resolve, 500))
    
    const result = {
      text: text.trim(),
      aiProbability: Math.floor(Math.random() * 100),
      detectedModel: ['GPT-4', 'Claude', 'Gemini'][Math.floor(Math.random() * 3)]
    }
    
    batchResults.value.push(result)
  }
  
  isBatchDetecting.value = false
}

const clearAll = () => {
  inputText.value = ''
  detectionResult.value = null
}

const clearBatch = () => {
  batchTexts.value = ''
  batchResults.value = []
}

const getScoreClass = (score) => {
  if (score >= 70) return 'high'
  if (score >= 40) return 'medium'
  return 'low'
}

const exportResult = () => {
  console.log('导出结果')
}

const shareResult = () => {
  console.log('分享结果')
}

const showBatchDetail = (result) => {
  console.log('显示批量检测详情:', result)
}
</script>

<style scoped>
.text-detection {
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
  background: #f8f9fa;
  min-height: 100vh;
}

/* 响应式设计 */
@media (max-width: 1600px) {
  .text-detection {
    width: 90%;
  }
}

@media (max-width: 1200px) {
  .text-detection {
    width: 95%;
  }
}

@media (max-width: 768px) {
  .text-detection {
    width: 100%;
    padding: 10px;
  }
}

.page-header {
  text-align: center;
  margin-bottom: 30px;
}

.page-header h1 {
  font-size: 2.5em;
  color: #1e3c72;
  margin-bottom: 10px;
}

.input-section {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

.input-methods {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.method-btn {
  padding: 10px 20px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.method-btn:hover {
  border-color: #1e3c72;
}

.method-btn.active {
  background: #1e3c72;
  color: white;
  border-color: #1e3c72;
}

.text-input {
  width: 100%;
  height: 300px;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.6;
  resize: vertical;
}

.input-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: #666;
  font-size: 14px;
}

.file-upload {
  border: 2px dashed #ddd;
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  transition: all 0.3s ease;
}

.file-upload:hover {
  border-color: #1e3c72;
  background: #f8f9fa;
}

.upload-icon {
  font-size: 3em;
  margin-bottom: 15px;
}

.file-hint {
  color: #999;
  font-size: 14px;
  margin-bottom: 20px;
}

.upload-btn {
  padding: 12px 30px;
  background: #1e3c72;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
}

.url-form {
  display: flex;
  gap: 15px;
  align-items: center;
}

.url-field {
  flex: 1;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
}

.fetch-btn {
  padding: 15px 25px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.detection-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
}

.detect-btn {
  padding: 15px 40px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
}

.detect-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.clear-btn {
  padding: 15px 40px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
}

.result-section {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.confidence-score {
  text-align: center;
}

.score-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  font-weight: bold;
  color: white;
  margin-bottom: 5px;
}

.score-circle.high {
  background: #dc3545;
}

.score-circle.medium {
  background: #ffc107;
}

.score-circle.low {
  background: #28a745;
}

.score-label {
  font-size: 0.9em;
  color: #666;
}

.result-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: #1e3c72;
  color: white;
  border-color: #1e3c72;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.analysis-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
}

.analysis-card h3 {
  color: #1e3c72;
  margin-bottom: 15px;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.feature-label {
  color: #666;
  font-weight: 500;
}

.feature-value {
  color: #333;
}

.model-predictions {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.model-item {
  display: flex;
  align-items: center;
  gap: 15px;
}

.model-name {
  width: 80px;
  font-weight: 500;
  color: #333;
}

.model-probability {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.probability-bar {
  flex: 1;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.probability-fill {
  height: 100%;
  background: #1e3c72;
  transition: width 0.3s ease;
}

.probability-text {
  width: 40px;
  text-align: right;
  color: #666;
  font-size: 14px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

.metric-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
}

.metric-card h3 {
  color: #1e3c72;
  margin-bottom: 15px;
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.metric-label {
  width: 120px;
  font-size: 14px;
  color: #666;
}

.metric-bar {
  flex: 1;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  background: #1e3c72;
  transition: width 0.3s ease;
}

.metric-value {
  width: 40px;
  text-align: right;
  font-size: 14px;
  color: #666;
}

.paragraph-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.paragraph-item {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  border-left: 4px solid #1e3c72;
}

.paragraph-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.paragraph-index {
  font-weight: 500;
  color: #1e3c72;
}

.paragraph-score {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: bold;
  color: white;
}

.paragraph-score.high {
  background: #dc3545;
}

.paragraph-score.medium {
  background: #ffc107;
}

.paragraph-score.low {
  background: #28a745;
}

.paragraph-content {
  margin-bottom: 15px;
  line-height: 1.6;
  color: #333;
}

.paragraph-analysis-details {
  display: flex;
  gap: 30px;
}

.analysis-item {
  display: flex;
  gap: 10px;
  font-size: 14px;
}

.analysis-label {
  color: #666;
}

.analysis-value {
  color: #333;
  font-weight: 500;
}

.technical-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.technical-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
}

.technical-card h3 {
  color: #1e3c72;
  margin-bottom: 15px;
}

.tech-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tech-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.tech-label {
  color: #666;
  font-weight: 500;
}

.tech-value {
  color: #333;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.stat-item {
  text-align: center;
  padding: 15px;
  background: white;
  border-radius: 8px;
}

.stat-value {
  font-size: 1.5em;
  font-weight: bold;
  color: #1e3c72;
}

.stat-label {
  color: #666;
  font-size: 0.9em;
  margin-top: 5px;
}

.result-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

.export-btn {
  padding: 12px 30px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
}

.share-btn {
  padding: 12px 30px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
}

.batch-section {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

.batch-section h2 {
  color: #1e3c72;
  margin-bottom: 20px;
}

.batch-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.batch-textarea {
  width: 100%;
  height: 200px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 14px;
  resize: vertical;
}

.batch-info {
  margin-top: 10px;
  color: #666;
  font-size: 14px;
}

.batch-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.batch-detect-btn {
  padding: 15px 25px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}

.batch-detect-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.batch-clear-btn {
  padding: 15px 25px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}

.batch-results {
  margin-top: 20px;
}

.batch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.batch-header h3 {
  color: #1e3c72;
  margin: 0;
}

.batch-summary {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: #666;
}

.batch-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.batch-item {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  border-left: 4px solid #1e3c72;
}

.batch-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.batch-item-index {
  font-weight: 500;
  color: #1e3c72;
}

.batch-item-score {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: bold;
  color: white;
}

.batch-item-content {
  margin-bottom: 15px;
  color: #333;
  line-height: 1.5;
}

.batch-item-actions {
  display: flex;
  gap: 10px;
}

.detail-btn {
  padding: 6px 12px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

@media (max-width: 768px) {
  .analysis-grid {
    grid-template-columns: 1fr;
  }
  
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .technical-grid {
    grid-template-columns: 1fr;
  }
  
  .batch-container {
    grid-template-columns: 1fr;
  }
  
  .url-form {
    flex-direction: column;
    align-items: stretch;
  }
  
  .input-methods {
    flex-direction: column;
  }
  
  .method-btn {
    justify-content: center;
  }
}
</style> 